package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Account    string `gorm:"type:varchar(30);comment:'账号'"`
	Password   string `gorm:"type:char(32);comment:'密码'"`
	MemberData int64  `gorm:"type:datetime;comment:'会员到期时间'"`
	Status     string `gorm:"type:varchar(20);comment:'用户状态'"`
}

func (u *User) GetUserByAccount() error {
	return DB.Where("account=?", u.Account).Limit(1).Find(&u).Error
}

func (u *User) GetUserById() error {
	return DB.Where("id=?", u.ID).Limit(1).Find(&u).Error
}
